<?php

/**
 * 
 *
 * @author srkrishnan
 */

/**

 * @property CI_Loader $load

 * @property CI_Form_validation $form_validation

 * @property CI_Input $input

 * @property CI_Email $email

 * @property CI_DB_active_record $db

 * @property CI_DB_forge $dbforge
 * 
 * @property problem $problem 
 * 
 * @property Solution $solution
 * 
 * @property CI_Session $session

 */
class Codeeditor extends CI_Controller {

    function Codeeditor() {
        parent::__construct();
        $this->load->model('problem');
        $this->load->model('solution');
        $this->load->helper('url');
        $this->load->library('session');
    }

    public $data = '';

    public $userid='';
    
    function index() {

        
        
        redirect('codeeditor/getproblem/1');
        
    }

    function getproblem($problemid=1) {

        
        $this->userid=$this->session->userdata('userid');
        
        if($this->userid==null){
            $this->session->set_userdata('userid',1);
        }
        
        $this->userid=$this->session->userdata('userid');
        
        $this->data['content'] = 'codeeditor';
        $this->data['title'] = 'HappyCode';
        $this->data['problem'] = $this->problem->getproblem($problemid);
        $this->data['userid']=$this->userid;
        $this->session->set_userdata('problemid',$problemid);
        
        $this->solution->getsolution($this->userid, $problemid,$this->data);
        
        $d=$this->data;
        
        $this->load->view('template', $this->data);
    }

    
}

?>
